<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="../static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="../static/easyui/jedate.min.js"></script>
<script type="text/javascript" src="../static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="../static/easyui/themes/icon.css">
<link rel="stylesheet" href="../static/easyui/themes/metro-orange/easyui.css">
<link rel="stylesheet" href="../static/easyui/themes/metro-red/window.css">
<link rel="stylesheet" href="../static/ttt/css/SocialSecurityAccount.css?<%=Math.random()%>">
<style type="text/css">

</style>
</head>
<body>
<script type="text/javascript">
function social_tables(){
	$('#SocialSecurityAccount_table').datagrid({    
		 url:'SocialSecurityAccount_table', //数据源地址
	   columns:[[    
		    {field:'SZID',fixed:false,width:213,title:'社保套账编号',hidden:true,align:'center'},  
	   		{field:'SZNAME',fixed:false,width:213,title:'社保套账名称',align:'center'},    
	        {field:'EMPNAME',fixed:false,width:213,title:'创建人',align:'center'},   
	       	{field:'EMPTIME',fixed:false,width:213,title:'创建日期',align:'center',
	        	formatter : function(value){
	        		var d = new Date(value);
	        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
	        		return times;
	        	}
	       	},   
	        {field:'SZREM',fixed:false,width:213,title:'备注',align:'center'},
	       {field:'dates2',fixed:false,width:213,formatter:salary_caozuo,title:'操作',align:'center'} 
	      
	    ]],
	   pagination:true,
	   pageNumber:1,
	   pageSize:5,
	   pageList:[5,10,15] 
	}); 
}
function shebao_xiangmuy(){
	$('#SocialSecurityAccount_xiangmutable').datagrid({    
		url:'SecurityAccount_xiangmutables', //数据源地址,checkbox:true
	   columns:[[    
		   {field:'SCSYID',width:100,title:'编号',checkbox:true},
	   	   {field:'SCSYNAME',width:100,title:'项目名称',align:'center'},  
	       {field:'SCSYTYPE',width:100,title:'社保类型',align:'center'}
/* 	       {field:'caozuo',width:100,formatter:caozuo,title:'操作'}  */
	      
	    ]]
	}); 
}
$(function(){
/* 	$('#SocialSecurityAccount_xiangmutablew').datagrid({    
		 url:'yyt', //数据源地址,checkbox:true
		 columns:[[    
		   {field:'SCSYID',width:100,title:'编号',align:'center'},  
	   	   {field:'SCSYNAME',width:100,title:'项目名称',align:'center'}, 
	   	   {field:'SCSYTYPE',width:100,title:'社保类型',align:'center'}
	    ]]
	}); */
	social_tables();
	
	shebao_xiangmuy();
	$("#shebao_tishi").hide();
 	//点击新增社保项目
 	$("#SocialSecurityAccount_add").click(function(){
 		$("#nashui_win").window("open");
 	})
 	//点击新增社保套账
 	$("#addSocialSecurityAccount").click(function(){
 		$("#SocialSecurityAccount_tijiao").show();
	 	$("#SocialSecurity_taozhangname").val("");
	 	$("#SocialSecurity_taozhangname").removeAttr("readonly");
		$("#SocialSecurityAccount_beizhutext").val("")
		$("#SocialSecurityAccount_beizhutext").removeAttr("readonly");
		/* $("#cial_shenhe").combobox('clear');
		$ ("#cial_shenhe").combobox({readonly: false}); */
		$("#SocialSecurityAccount_win").window("open");
		shebao_xiangmuy();
		 
	}) 
	//点击关闭窗口社保套账新增擦虹口
	$("#SocialSecurityAccount_quxiao").click(function(){
		$("#SocialSecurityAccount_win").window("close");
	})
	//项目套账新增页面--提交按钮点击事件
	$("#SocialSecurityAccount_tijiao").click(function(){
		var szname=$("#SocialSecurity_taozhangname").val();
		//var shenpiren=$("#cial_shenhe").combobox('getValue')
		var szrem=$("#SocialSecurityAccount_beizhutext").val();
		var rows = $("#SocialSecurityAccount_xiangmutable").datagrid("getSelections");
		var bianhao="";
 		for(var i=0;i<rows.length;i++){
			bianhao+=rows[i].SCSYID+",";
 		}
 		if(szrem==""){
 			szrem="无"
 		}
		 if(szname==""){
			alert("请输入社保套账名称")
		}else if(rows.length==0){
			alert("请选择社保项目")
		}else{
			$.ajax({
				type:"post",
				url:'SecurityAccountTable', //数据源地址
				data:{
					szname:szname,
					szrem:szrem,
					bianhao:bianhao
				},
				success: function(data){ 
					social_tables();
				}
			}) 
				$("#SocialSecurityAccount_win").window("close");
		}
	})
	//查询selectSocialSecurityAccountName
	$("#selectSocialSecurityAccountName").click(function(){
		if($("#SocialSecurity_nametext").val()!=""){
			$('#SocialSecurityAccount_table').datagrid({    
				 url:'SocialSecurityAccount_table_name', //数据源地址
				 queryParams:{
					 text:$("#SocialSecurity_nametext").val()
				 },
			   columns:[[    
				    {field:'SZID',fixed:false,width:213,title:'社保套账编号',hidden:true,align:'center'},  
			   		{field:'SZNAME',fixed:false,width:213,title:'社保套账名称',align:'center'},    
			        {field:'EMPNAME',fixed:false,width:213,title:'创建人',align:'center'},   
			       	{field:'EMPTIME',fixed:false,width:213,title:'创建日期',align:'center',
			        	formatter : function(value){
			        		var d = new Date(value);
			        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
			        		return times;
			        	}
			       	},   
			        {field:'SZREM',fixed:false,width:213,title:'备注',align:'center'},
			       {field:'dates2',fixed:false,width:213,formatter:salary_caozuo,title:'操作',align:'center'} 
			      
			    ]],
			   pagination:true,
			   pageNumber:1,
			   pageSize:5,
			   pageList:[5,10,15] 
			}); 
		}else if($("#SocialSecurity_nametext").val()==""){
			social_tables();
		}
		
	})
})
//在每个操作列里面添加编辑，查看，明细，删除
	function salary_caozuo(value, row, index) {
		return "<span class='spanclass' onclick='salary_chakans()'>查看社保项目</span> ";
	} 
	function salary_chakans(){
		var rows=$('#SocialSecurityAccount_table').datagrid('getChecked');
		
		$.ajax({
		type:"post",
		url:'sec_Byszid', //数据源地址
		data:{szid:rows[0].SZID},
		success:function(data){
			$("#SocialSecurityAccount_winy").window("open");
			$('#SocialSecurityAccount_xiangmutablew').datagrid({    
				 url:'acu_biao', //数据源地址,checkbox:true
				 columns:[[    
				   {field:'SCSYID',width:100,title:'编号',align:'center'},  
			   	   {field:'SCSYNAME',width:100,title:'项目名称',align:'center'}, 
			   	   {field:'SCSYTYPE',width:100,title:'社保类型',align:'center'}
			    ]]
			});
			
		}
		
		})
		
	}
 function caozuo(value, row, index){
	return "<a  class='spanclass'>删除</a> ";
 }  
</script>
<div id="SocialSecurityAccount_winy" class="easyui-window" title="社保项目" style="width:700px;height:550px"
			data-options="modal:true,resizable: false,draggable:false,closed:true,minimizable:false,maximizable:false,collapsible:false">
		<div id="SocialSecurityAccount_box4sw" style="whidth:100%;height:100%;padding:5px;">
	 		<table id="SocialSecurityAccount_xiangmutablew" class="easyui-datagrid" style="width:100%;height:495px;" data-options="fitColumns:true">
						
			</table>
		</div>
	</div>
	<div id="SocialSecurityAccount_win" class="easyui-window" title="社保项目" style="width:700px;height:550px"
			data-options="modal:true,resizable: false,draggable:false,closed:true,minimizable:false,maximizable:false,collapsible:false">
		<div  id="SocialSecurityAccount_name">
			<span class="addPayment_win_Account">套账名称：</span>
			<input type="text" id="SocialSecurity_taozhangname" class="SocialSecurityClass">
		</div>
		<div id="SocialSecurityAccount_box2" class="addPayment_win_box SocialSecurityAccount_peoples">
			<a id="SocialSecurityAccount_beizhu" class="addPayment_win_Account" style="">备注：</a>
			<input  id="SocialSecurityAccount_beizhutext" style="height:35px;width:174px;" type="text"/>
		</div>
		<div id="SocialSecurityAccount_box3">
			<div id="addSocialSecurityAccount_xiangmu">新增项目</div>
		</div>
		<div id="SocialSecurityAccount_box4s">
	 		<table id="SocialSecurityAccount_xiangmutable" class="easyui-datagrid" style="width:100%/* calc(100% - 10px) */;height:270px;" data-options="fitColumns:true">
						
			</table>
		</div>
		<div id="SocialSecurityAccount_box4">
				<button id="SocialSecurityAccount_tijiao" class="SocialSecurity" style="margin-right:15px;">
				<img src="../static/tyl/images/go.png">
				提交</button>
				<button id="SocialSecurityAccount_quxiao" class="SocialSecurity" style="margin-right:15px;">
				<img src="../static/tyl/images/cha.png">
				取消</button>
		</div> 
	</div>
	<div id="SocialSecurityAccountbox">
		    <span id="SocialSecurityAccountname" class="fontstyle">套账名称：<span><input text="text" id="SocialSecurity_nametext" class="TrainingPlanName">
			<button id="selectSocialSecurityAccountName" class="SocialSecurity" style="margin-right:15px;">查询</button>
			<button id="addSocialSecurityAccount" class="SocialSecurity" style="margin-right:15px;">新增</button>
	</div>
	<div class="table_1">
		<table id="SocialSecurityAccount_table" class="easyui-datagrid" style="width:calc(100% - 10px);height:480px;" data-options="fitColumns:true">
						
		</table>
	</div>
</body>
</html>